CREATE TABLE [dbo].[FileAttach]
(
[AttachId] [int] NOT NULL IDENTITY(1, 1),
[TemplateId] [int] NULL,
[SiteContentId] [int] NULL,
[EventId] [int] NULL,
[DocumentName] [nvarchar] (250) COLLATE Cyrillic_General_CI_AS NOT NULL,
[DocumentType] [nvarchar] (100) COLLATE Cyrillic_General_CI_AS NOT NULL,
[DocumentSize] [int] NOT NULL,
[IsDeleted] [bit] NOT NULL,
[CreateDate] [datetime] NOT NULL,
[LastModifiedDate] [datetime] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[FileAttach] ADD CONSTRAINT [PK_EmailTemplateAttach] PRIMARY KEY CLUSTERED  ([AttachId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[FileAttach] ADD CONSTRAINT [FK_FileAttach_SiteEvent] FOREIGN KEY ([EventId]) REFERENCES [dbo].[SiteEvent] ([EventId])
GO
ALTER TABLE [dbo].[FileAttach] ADD CONSTRAINT [FK_FileAttach_SiteContent] FOREIGN KEY ([SiteContentId]) REFERENCES [dbo].[SiteContent] ([SiteContentId])
GO
ALTER TABLE [dbo].[FileAttach] ADD CONSTRAINT [FK_FileAttach_EmailTemplate] FOREIGN KEY ([TemplateId]) REFERENCES [dbo].[EmailTemplate] ([TemplateId])
GO
